package one2Ten;

/**
 * 写一个单例模式
 * Created by Wongy on 2018/3/7.
 */
public class Two2 {
    private static volatile Two2 two2;

    private Two2() {
    }

    public static Two2 getTwo2() {
        if (two2 == null) {
            synchronized (Two2.class) {
                if (two2 == null) {
                    two2 = new Two2();
                }
            }
        }
        return two2;
    }
}
